
export default {

    namespace: 'theme',

    state: {
        theme:'light',
        collapsed: false,
        defaultSelectedKeys:[],
        defaultOpenKeys:[]
    },

    reducers: {
        'toggle'(state, {collapsed:type}) {
            let newState = Object.assign({}, state)
            newState.collapsed = type
            return newState
        },
        'changeTheme'(state, {data:value}) {
            let newState = Object.assign({}, state)
            newState.theme = value
            return newState
        },
        'menuClick'(state, {data}) {
            let menuSelect = data.map(item=>String(item))
            console.log(menuSelect)
            let SelectedKey = menuSelect.shift()
            let SelectedKeys = []
            SelectedKeys.push(SelectedKey)
            let newState = Object.assign({}, state)
            newState.defaultSelectedKeys = SelectedKeys
            newState.defaultOpenKeys = menuSelect
            return newState
        },
    },

};
